package cn._51doit.flink.day03;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class UnionDemo1 {

    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        //spark
        DataStreamSource<String> lines1 = env.socketTextStream("localhost", 8888);

        //abc
        DataStreamSource<String> lines2 = env.socketTextStream("localhost", 9999);

        DataStream<String> res = lines1.union(lines2);

        res.print();

        env.execute();

    }
}
